import request from '@/utils/request';
import qs from 'qs';

/**
 * 物流管理
 * @logisticsQueryPage：列表分页
 * @logisticsDownload：物流管理导出
 * @lmAddressQueryPage：罗慕地址
 * @addLmAddress：新增罗慕地址
 * @updataClinic：更新诊所
 */
export function logisticsQueryPage(params) {
  return request({
    url: process.env.VUE_APP_SALEAREA_API + '/org/clinic/query',
    method: 'get',
    params
  });
}
export function logisticsDownload(params) {
  return request({
    url: process.env.VUE_APP_SALEAREA_API + '/org/clinic/downloadAddress?' + qs.stringify(params, { indices: false }),
    method: 'get',
    responseType: 'blob'
  });
}
export function lmAddressQueryPage(params) {
  return request({
    url: process.env.VUE_APP_DICT_API + '/base/luomuAddress/query',
    method: 'get',
    params
  });
}
export function addLmAddress(data) {
  return request({
    url: process.env.VUE_APP_DICT_API + '/base/luomuAddress/create',
    method: 'post',
    data
  });
}
//  /org/salearea/id
export function updataClinic(data) {
 return request({
    url: process.env.VUE_APP_SALEAREA_API + '/org/clinic/updateMsg',
    method: 'post',
    data
 });
}

/**
 * 矫治器&牙模
 */
export function headgearDentalcastQueryPage(params) {
  return request({
    url: process.env.VUE_APP_LOG_API + '/base/logistics/query',
    method: 'get',
    params
  });
}

/**
 * 物料
 * @queryPage：物料列表查询（分页）
 * @confirmRecv：确认收货
 * @download：导出数据
 * @detail：查看详情
 */
export function queryPage(params) {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/bomLogistics/queryPage',
    method: 'get',
    params
  });
}
export function confirmRecv(data) {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/bomLogistics/confirmRecv/' + data,
    method: 'post'
  });
}
export function download(url, params) {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/bomLogistics/download?' + qs.stringify(params, { indices: false }),
    method: 'get',
    responseType: 'blob'
  });
}
export function detail(params) {
  return request({
    url: process.env.VUE_APP_PRODUCT_API + '/oper/bomLogistics/packageDetail/' + params,
    method: 'get'
  });
}
